<div class="container-fluid">
    <div class="row-fluid">
        <div class="span3">
            <?php echo $this->partial('choix/menu.phtml', array('num_vente' => $this->num_vente));?>
            <!--/.well -->
        </div>
        <!--/span-->
        <div class="span9">
            <div class="wrap">
                <div id="main-content">
                    <?php if ( $this->org == "all" || $this->org == "arc") :?>
                    <div class="top-link">
                        <a href="<?php echo $this->baseUrl()?>/admin/clients/search-email?org=<?php echo $this->org ?>&num_vente=<?php echo $this->num_vente ?>">Recherche email</a>
                        | <a href="<?php echo $this->baseUrl()?>/admin/clients/add?org=<?php echo $this->org ?>&num_vente=<?php echo $this->num_vente ?>">Ajouter un client</a>
                        | <a href="#">Fichier PDF</a>
                        | <a href="#">Fichier CSV</a>
                        | <a href="<?php echo $this->baseUrl()?>/admin/clients?org=new&num_vente=<?php echo $this->num_vente ?>">Nouveaux clients</a>
                        | <a href="<?php echo $this->baseUrl()?>/admin/clients?org=arc&num_vente=<?php echo $this->num_vente ?>">Clients archivés</a>
                    </div>
                    <?php else : ?>
                    <div class="top-link"><a href="<?php echo $this->baseUrl()?>/admin/clients?num_vente=<?php echo $this->num_vente ?>">Tous les clients</a></div>
                    <?php endif; ?>
                    <table>
                        <thead style="width:100%">
                            <tr>
                                <th>N° </th>
                                <th style="text-align:left">Nom </th>
                                <th style="text-align:left">Prénom</th>
                                <th>Editer</th>
                                <th>Supprimer</th>
                                <th>PDF</th>
                                <th>Codes</th>
                                <th>A confirmé</th>
                                <th>Est validé</th>
                             </tr>
                        </thead>
                        <tfoot>
                            <tr>
                                <td colspan="10">
                                    <?php if(count($this->paginator) > 1) :?>
                                        <?php echo $this->paginationControl($this->paginator, 'Sliding', '_pagination.phtml'); ?>
                                    <?php endif;?>
                                    <!-- End .pagination -->

                                    <div class="clear"></div>
                               </td>
                            </tr>
                        </tfoot>
                        <tbody style="width:100%">
                        <?php  foreach($this->paginator as $row):
                            $date = new DateTime($row['dtdemandevalid']);
                        ?>
                            <tr>
                                <td><a name="<?php echo $row['p_clients']?>"></a>
                                    <?php echo (stripslashes($row['num_client']) != "n")?(int)$row['num_client']:"n"?>
                                </td>
                                <td style="text-align:left"><?php echo stripslashes($row['nom']) ?></td>
                                <td style="text-align:left"><?php echo stripslashes($row['prenom'])?></td>
                                <td><a href="<?php echo $this->baseUrl()?>/admin/clients/edit?id=<?php echo $row['p_clients']?>&org=<?php echo $this->org ?>&num_vente=<?php echo $this->num_vente?>"><img src="<?php echo $this->baseUrl()?>/images/pencil.png" border="0" alt="Editer" title="Editer"></a></td>
                                <td><a class="delete-item" href="<?php echo $this->baseUrl()?>/admin/clients/delete?num=<?php echo $row['p_clients']?>&org=<?php echo $this->org ?>&num_vente=<?php echo $this->num_vente?>&page=<?php echo $this->page ?>"><img src="<?php echo $this->baseUrl()?>/images/cross.png" border="0" alt="Supprimer" title="Supprimer"></a></td>
                                <td>
                                    <a href="<?php echo $this->baseUrl('admin/clients/save-pdf/?id=' . $row['p_clients']) ?>&num_vente=<?php echo $this->request()->getParam('num_vente') ?>" target="_blank">
                                        <?php echo $this->image()->getPdf() ?>
                                    </a>
                                </td>
                                <td>
                                <?php if ($row['email'] != null):?>
                                    <a href="<?php echo $this->baseUrl('admin/clients/send-mail/?id=' . $row['p_clients']) ?>" target="_blank">
                                        <?php echo $this->image()->getMail(0, 'Envoi des codes') ?>
                                    </a>
                                <?php endif;?>
                                </td>

                                <td>
                                    <?php echo $this->image()->getStatus($row['dtconfirm']) ?>
                                </td>
                                <td>
                                    <?php
                                        if ($row['dtvalid'] == '' && $row['dtdemandevalid'] != '') {
                                            $warning =true;
                                            $title = 'Demande de validation le ' . $date->format('d/m/Y');
                                        } else {
                                            $warning = false;
                                            $title = '';
                                        }
                                    ?>
                                    <?php echo $this->image()->getStatus($row['dtvalid'], $title, $warning) ?>
                                </td>
                            </tr>
                         <?php endforeach; ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <!--/row-->
        </div>
        <!--/span-->
    </div>
    <!--/row-->
</div>